<?php

class Feedback extends Connection{
    
    public $name;
    public $email; 
    public $subject;
    public $message;
    
    
    function __construct(){
        parent::__construct();
    }
    
    public function sendFeedback(){
    $sql = "insert into feedbacks(fullname,email,subject,message) values('".
    trim($this->name)."','".trim($this->email)."','".trim($this->subject)."','".
    trim($this->message)."')";
    
    //execute query
    $result = $this->transact($sql);
    return $result; 

    }
    
    public function getAllFeedback(){
       $sql = "select * from feedbacks";
       $result = $this->query($sql);
       return $result;
    }
    
    
        
    public function setAsFAQ($id="",$answer = ""){
        $sql = "insert into FAQs(feed_id,answer) values('".
        trim($id)."','".trim($answer)."')";
        
        $result = $this->transact($sql);
        return $result;
    }
    public function deleteFeedback($id = ""){
        $sql = "delete from feedbacks where id='".$id."'";
        $result = $this->transact($sql);
        return $result;
    }
}
?>